#include <iostream>
#include <fstream>
#include <math.h>

using namespace std;

int sumDiv(int m);
int main()
{
    int sum = 0;
    int n;
    for (int m = 1;m< 10000 ;m++ )
    	{
    n = sumDiv(m);
    if (sumDiv(n) == m and m!= n){
         sum = sum + m;
    	cout << m << " , " << sumDiv(m) << endl;
    	}
    	}


    	cout << sum;
return 0;
}
int sumDiv(int m){
int    sum = 0;
    for (int i = 1;i < m ; i++ )
    	{
        if (m % i == 0) sum = sum + i;
    	    }


    return sum;
}
